home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.0 / card_11180.txt < prev    next >
Text File  |  1989-02-26  |  3KB  |  130 lines

  1. -- card: 11180 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3837
  5. -- name: FileModDate
  6. ----- HyperTalk script -----
  7. on closecard
  8.   hide message window
  9. end closecard
  10.  
  11.  
  12. -- part 1 (button)
  13. -- low flags: 00
  14. -- high flags: A003
  15. -- rect: left=82 top=302 right=324 bottom=182
  16. -- title width / last selected line: 0
  17. -- icon id / first selected line: 0 / 0
  18. -- text alignment: 1
  19. -- font id: 0
  20. -- text size: 12
  21. -- style flags: 0
  22. -- line height: 16
  23. -- part name: Install
  24. ----- HyperTalk script -----
  25. on mouseUp
  26.   if the optionkey is down then
  27.     pass mouseup
  28.   end if
  29.  
  30.   put (long name of this stack) into sourceStack
  31.   delete first word of sourceStack
  32.   delete first character of sourceStack
  33.   delete last character of sourceStack
  34.   put "Select a stack to copy this resource into."
  35.   put filename("STAK") into fname
  36.   if fname is empty then
  37.     hide message window
  38.     exit mouseup
  39.   end if
  40.   if sourcestack=fname then
  41.     beep
  42.     Answer "Get real.  You can't install it in this stack"
  43.     hide message window
  44.     exit mouseup
  45.   end if
  46.  
  47.   --
  48.   ModResCopy sourceStack,fname,"XFCN","FileModDate"
  49.   --
  50.   get the result
  51.   if first char of it is "E" then
  52.     put it into the message box
  53.     beep
  54.     answer "Attempt to install resource has failed."
  55.   else
  56.     beep
  57.     answer "Resource installation successful"
  58.   end if
  59.   hide message window
  60. end mouseUp
  61.  
  62.  
  63.  
  64. -- part 2 (button)
  65. -- low flags: 00
  66. -- high flags: A004
  67. -- rect: left=231 top=244 right=297 bottom=290
  68. -- title width / last selected line: 0
  69. -- icon id / first selected line: 27056 / 27056
  70. -- text alignment: 1
  71. -- font id: 0
  72. -- text size: 12
  73. -- style flags: 0
  74. -- line height: 16
  75. -- part name: Try this
  76. ----- HyperTalk script -----
  77. on mouseUp
  78.   put "Select a file..."
  79.   put filename() into thisfile
  80.   put "Created on " into info
  81.   convert fileModDate(thisfile,true) to short date
  82.   put it after info
  83.   put "; Modified on " after info
  84.   convert fileModDate(thisfile,false) to short date
  85.   put it after info
  86.   put info
  87. end mouseUp
  88.  
  89.  
  90.  
  91. -- part contents for background part 5
  92. ----- text -----
  93. FileModDate
  94.  
  95. -- part contents for background part 10
  96. ----- text -----
  97. 7
  98.  
  99. -- part contents for background part 6
  100. ----- text -----
  101.  
  102. This can be used to get the creation or modification date of a file, or as a 'File exists' utility.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. Thanks to:
  112. Dewi Williams
  113. 2227 Juniper Court
  114. Boulder CO 80302
  115. (303) 443 9038
  116. Delphi: DEWI
  117.  
  118.  
  119. -- part contents for background part 7
  120. ----- text -----
  121. Syntax:
  122.  
  123. put FileModDate("PathName",
  124. <needCreation>) into thisDate
  125.  
  126. "PathName" is the full pathname to the target.
  127.  
  128. <needCreation> can be true or false.  If it is true, the function will return the creation date, otherwise it will return the modification date.
  129. The date is returned in ticks format.
  130. If there is an error an empty string is returned.